how to make a singleton in unity

51

how to make a singleton in unity -

 void Awake()
 {
   if (instance == null)
     instance = this;
   else if (instance != this)
     Destroy(gameObject);
 }

Comments

Submit
0 Comments